package com.zlz.m3u8download.util;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @Author: zhulinzhong
 * @Date: 2024/11/28
 */
public class ThreadPool {
    // 核心线程数为20
    private static int corePoolSize = 5;
    // 最大线程数为20
    private static int maximumPoolSize = 5;
    // 线程空闲时间，这里设置为60秒
    private static long keepAliveTime = 60;
    private static TimeUnit unit =  TimeUnit.SECONDS;
    // 任务队列，这里使用LinkedBlockingQueue
    private static BlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<>();

    // 创建ThreadPoolExecutor
    public static ThreadPoolExecutor TASK_EXECUTOR = new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);

}
